<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="java.io.*"%>
<%@ page import="requestInterFace.Handle.userHandle"%>
<%@ page import="xml.response.*"%>
<%@ page import="xml.root"%>
<%@ page import="util.print.printLogCat"%>
<%@ page import="org.sql.table.*"%>
<%@ page import="xml.var"%>
<%@ page import="java.util.Vector"%>
<%@ page import="java.util.Enumeration"%>
<%@ page import="requestInterFace.UserInfoInterFace.*"%>
<%@ page import="jqgrid.jqgrid"%>
<%@ page import="util.check"%>
<%@ include file="../../util/paramPrint.jsp" %>
<%@ page trimDirectiveWhitespaces="true" %> 
<%   

    /*********** jqgrid ******************/
		jqgrid jq=new jqgrid();
		jq.setRows(request.getParameter(jqgrid._rows));
		jq.setSord(request.getParameter(jqgrid._sord));
		jq.setSortname(request.getParameter(jqgrid._sortname));
		jq.setPage(request.getParameter(jqgrid._page));
		jq.setOper(request.getParameter(jqgrid._oper));
		jq.setSearch(request.getParameter(jqgrid._search));
		/*************************************/
		
		
String User_ID = request.getParameter("User_ID");
String ModifyUser_ID = request.getParameter("ModifyUser_ID");
String Login_Pwd = request.getParameter("Login_Pwd");
String name = request.getParameter("User_Name");
String Login_Name = request.getParameter("Login_Name");//刚上联系人名称
String User_type = request.getParameter("User_Type");
String UP_ID =request.getParameter("UP_ID");//业务员ID
String Called_Time =request.getParameter("Called_Time");//开始访问时间
String Addr =request.getParameter("Addr");//用户地址
String Email =request.getParameter("Email");//Email
String Tel =request.getParameter("Tel");//Email
String userType=(String)session.getAttribute("User_Type");
String userID=(String)session.getAttribute("User_ID");
root root=new root();
if(userType==null||userID==null||(!userType.equals("1")&&!userID.equals(User_ID))){
root.setStatus("false");
root.setMsg("权限不够");
PrintWriter pw = response.getWriter();
pw.println(root.getXmlString());
pw.flush();
return ;
}
 
		userinfo1_1 user=new userinfo1_1();
		
		if(User_ID!=null&&(!User_ID.equals(""))){
		 user.addequwhile("User_ID"," = ",User_ID);
		}else{
			 root.setStatus("false");
			root.setMsg("请输入用户ID");
			PrintWriter pw = response.getWriter();
			pw.println(root.getXmlString());
			pw.flush();
			return ;
		}
		if(name!=null&&(!name.equals(""))){
		 user.setUpdateField("User_Name",name);
		}
		
		if(Login_Pwd!=null&&(!Login_Pwd.equals(""))){
		  // if(userID.equals(User_ID)){
		    user.setUpdateField("Login_Pwd",Login_Pwd);
		  // }
		}
		
		if(User_type!=null&&(!User_type.equals(""))){
		  if(userType.equals("1")){
		     user.setUpdateField("User_type",User_type);
		   }
	
		}	
		if(check.checkString(Login_Name)){
				user.setUpdateField("Login_Name", Login_Name);
		}
		if(UP_ID!=null&&(!UP_ID.equals(""))){
		  user.setUpdateField("UP_ID",UP_ID);
		}
		if(ModifyUser_ID!=null&&(!ModifyUser_ID.equals(""))){
		  user.setUpdateField("User_ID",ModifyUser_ID);
		}
		if(Called_Time!=null&&(!Called_Time.equals(""))){
		   user.setUpdateField("Called_Time",Called_Time);
		}
		if(Addr!=null&&(!Addr.equals(""))){
		  user.setUpdateField("Addr",Addr);
		}
		if(Email!=null&&(!Email.equals(""))){
		   user.setUpdateField("Email",Email);
		}
		if(Tel!=null&&(!Tel.equals(""))){
		  user.setUpdateField("Tel",Tel);
		}
		int row=user.updata();
		root.setRecords(""+row);//设置当前查询到的记录数
		if(row>0){
			root.setStatus("true");
			root.setMsg("修改成功");
		}else{
			root.setStatus("false");
			root.setMsg("修改失败");
		}
		//printLogCat.printlnWriter(root.getXmlString());
		String rep=root.getXmlString();
%>
<%=rep%>
